<?php

namespace app\index\model;


use think\Model;

class createWord extends Model
{
   public function createword($info,$data){

    $content = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" "><head><STYLE>BR.page { page-break-after: always }</STYLE><meta charset="UTF-8"><xml><w:WordDocument><w:View>Print</w:View></xml></head><body><style>tr td{width:380px;text-align:center;font-size:8px;} .title{width:100%;font-size:22px;text-align:center;}.title1{font-size:30px;margin-top:20px;text-align:center;}</style>';
    //   $this->start('<table><tr><td>123123123312</td></tr></table>');
    $content .='<br/><br/><br/><br/><br/><br/><br/><br/>';
    $content .='<div class="title">天津市教委科研计划专项任务项目</div><div class="title">(心理健康教育)</div>';
    $content .='<div class="title1" style="font-size:18px;margin-top:85px;">课题名称 <span style="text-decoration:underline;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>';
    $content .='<div class="title1" style="font-size:18px;margin-top:25px;">课题申请人 <span style="text-decoration:underline;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>';
    if($info['if_two']==1){
    $content .='<div class="title1" style="font-size:18px;margin-top:25px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="text-decoration:underline;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>';
    }
    $content .='<div class="title1" style="font-size:18px;margin-top:25px;">所在单位 <span style="text-decoration:underline;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>';
    $content .='<div class="title1" style="font-size:18px;margin-top:25px;">填表日期 <span style="text-decoration:underline;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>';
    $content .='<div style="margin-top:50px;font-size:16px;font-weight: bold;width:100%;text-align:center;">天津市教委科研处制</div>';
    $content .='<div style="margin-top:20px;font-size:16px;font-weight: bold;width:100%;text-align:center;">2020年6月</div><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>';
    
    $content.='<div style="font-size:18px;margin-left:45px;">申请者的承诺：</div>';
    
    $content.='<div style="padding:25px;font-size:18px;margin-top:28px;line-height:25px;">我承诺对本人填写的各项内容的真实性负责，保证没有知识产权争议。如获准立项，我承诺以本表为有约束力的协议，遵守天津市教委科研计划专项任务项目（心理健康教育）管理办法的有关规定，按计划认真开展研究工作，取得预期研究成果。天津市教育委员会学生处、科研处和天津市学生心理健康教育发展中心有权使用本表所有数据和资料。</div>';
    $content .='<div style="width:100%;text-align:center;margin-top:35px;font-size:18px;">申请者（签章）：</div>';
    $content .='<div style="width:100%;text-align:right;margin-top:35px;font-size:18px;">年&nbsp;&nbsp;&nbsp;&nbsp; 月&nbsp;&nbsp;&nbsp;&nbsp; 日&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; </div>';
    $content.='<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>';
    $content.='<div style="width:100%;text-align:center;font-size:14px;">填表说明</div><br/><br/><br/>';
    $content.='<div style="padding:25px;font-size:16px;line-height:35px;">一、本表所用的代码请查阅国家技术监督局2009年11月发布实施的国家标准“学科分类与代码”（GB/TI3745—2009）。<br/>二、研究类别：选择“基础理论研究”、“应用理论研究”、“应用研究”其中之一填写。<br/>三、最终成果形式：著作、论文、研究或咨询报告、专利。涉密成果按照密级管理要求办理。<br/>四、研究方向：按照《国标代码》中三级学科名称及代码填写，如没有三级学科，按照二级学科填写。<br/>五、申请评审书用A4纸双面打印，报送一式5份，并于左
侧装订成册，统一报送上级主管部门。</div><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>';
    if($data['sex']==1){
        $data['sex'] ='男';
    }else{
        $data['sex'] = '女';
    }
    $content .='<table border="1" cellpadding="3" cellspacing="0" >';
    $content .='<tr><td width="28px" rowspan="4">第一申请人</td><td>姓名</td><td>'.$data['name'].'</td><td>性别</td><td>'.$data['sex'].'</td><td>出生年月</td><td>'.$data['birthday'].'</td></tr>';
    if($data['if_teacher']==1){
        $data['if_teacher'] = '是';
    }else{
        $data['if_teacher'] = '否';
    }
    $content .='<tr><td width="32px">职务职称</td><td>'.$data['zhiwu'].'</td><td>所在部门</td><td colspan="3">'.$data['bumen'].'</td></tr>';
    $content .='<tr><td>是否专职教师</td><td>'.$data['if_teacher'].'</td><td>最后学历</td><td>'.$data['xueli'].'</td><td>最后学位</td><td>'.$data['xuewei'].'</td></tr>';
    $content .='<tr><td>外语语种及水平</td><td>'.$data['waiyu'].'</td><td>专业领域</td><td>'.$data['lingyu'].'</td><td>联系电话</td><td>'.$data['phone'].'</td></tr>';
    if($info['if_two']==1){
        if($data['sex2']==1){
            $data['sex2'] ='男';
        }else{
            $data['sex2'] = '女';
        }
        $content .='<tr><td width="32px" rowspan="4">第二申请人</td><td>姓名</td><td>'.$data['name2'].'</td><td>性别</td><td>'.$data['sex2'].'</td><td>出生年月</td><td>'.$data['birthday2'].'</td></tr>';
        if($data['if_teacher2']==1){
            $data['if_teacher2'] = '是';
        }else{
            $data['if_teacher2'] = '否';
        }
        $content .='<tr><td>职务职称</td><td>'.$data['zhiwu2'].'</td><td>所在部门</td><td colspan="3">'.$data['bumen2'].'</td></tr>';
        $content .='<tr><td>是否专职教师</td><td>'.$data['if_teacher2'].'</td><td>最后学历</td><td>'.$data['xueli2'].'</td><td>最后学位</td><td>'.$data['xuewei2'].'</td></tr>';
        $content .='<tr><td>外语语种及水平</td><td>'.$data['waiyu2'].'</td><td>专业领域</td><td>'.$data['lingyu2'].'</td><td>联系电话</td><td>'.$data['phone2'].'</td></tr>';
    }
    $content .='</table>';
    $content.='<span lang=EN-US style="font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:" mce_style="font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-font-kerning:1.0pt;mso-ansi-language EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA"><br clear=all style="page-break-before:always" mce_style="page-break-before:always"></span>';
    $content .="</body></html>";
    
    $this->start($content);
    echo $content;die;
       dump($data);die;
       dump($info);exit();
   }
   public function start($content)
    {
        $filename = 'word' . date('Ymd', time()) . uniqid("_") . '.doc';
        $path_dir = './uploads/' . date("Y-m-d") . "/";//目录
        if (!is_dir($path_dir)) mkdir($path_dir, 0777, true);
        $fp = fopen($path_dir  . $filename, 'w');
        fwrite($fp, $content);

    }

}